﻿<navigation:Page x:Class="LEEAAttendanceControl.Views.EmployeesExceptions" 
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
           xmlns:my="clr-namespace:LEEAAttendanceControl.Web.Services"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           mc:Ignorable="d"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Employees Exceptions">
    <Grid x:Name="LayoutRoot">
        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="300"/>
                    <RowDefinition Height="280"/>
                </Grid.RowDefinitions>

                <StackPanel Orientation="Vertical" Grid.Row="0">
                    <riaControls:DomainDataSource x:Name="ExAssignmentsDataSource" AutoLoad="True" PageSize="15"
                                              QueryName="GetExceptionAssignmentSummaries" LoadSize="20"
                                              LoadingData="DomainDataSource_LoadingData">
                        <riaControls:DomainDataSource.DomainContext>
                            <my:LEEAContext />
                        </riaControls:DomainDataSource.DomainContext>
                    </riaControls:DomainDataSource>

                    <Grid Background="#404041">
                        <TextBlock Text="Employees Exceptions" Foreground="White" FontSize="14" FontWeight="Bold"
                               Margin="5,3,3,2" HorizontalAlignment="Left"/>
                    </Grid>

                    <sdk:DataGrid x:Name="ExAssignmentsGrid" AutoGenerateColumns="False" IsReadOnly="True"
                                  ItemsSource="{Binding Data, ElementName=ExAssignmentsDataSource}" MaxHeight="250"
                                  SelectionChanged="ExAssignmentsGrid_SelectionChanged">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTemplateColumn Header="First Name" CanUserReorder="False" CanUserResize="False"
                                                    Width="245">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding FirstName}" HorizontalAlignment="Left" Margin="5,2,2,2"
                                               VerticalAlignment="Center" Height="22"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Last Name" CanUserReorder="False" CanUserResize="False"
                                                    Width="245">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding LastName}" HorizontalAlignment="Left" Margin="5,2,2,2"
                                               VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Department" CanUserReorder="False" CanUserResize="False"
                                                    Width="276">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding Department}" HorizontalAlignment="Left" Margin="5,2,2,2"
                                               VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>

                    <sdk:DataPager PageSize="15" Source="{Binding Data, ElementName=ExAssignmentsDataSource}"/>
                </StackPanel>

                <StackPanel Orientation="Vertical" HorizontalAlignment="Left" Grid.Row="1" Margin="0,5,0,5">
                    <Grid Background="#404041">
                        <TextBlock Text="Exceptions" Foreground="White" FontSize="12" FontWeight="Bold" Margin="5,3,3,2"
                                   HorizontalAlignment="Left"/>
                    </Grid>

                    <sdk:DataGrid x:Name="ExceptionsGrid" AutoGenerateColumns="False" IsReadOnly="True"
                                  VerticalScrollBarVisibility="Visible" MaxHeight="240"
                                  ItemsSource="{Binding Data, ElementName=ExceptionsDataSource}">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTemplateColumn Header="Exception Name" CanUserReorder="False"
                                                                        CanUserResize="False" Width="280">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding ExceptionName}" Margin="5,2,2,2"
                                                                   HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="From" CanUserReorder="False"
                                                                        CanUserResize="False" Width="240">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding From, StringFormat='dd/MM/yyyy'}"
                                                                   Margin="5,2,2,2" HorizontalAlignment="Left"
                                                                   VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="To" CanUserReorder="False"
                                                                        CanUserResize="False" Width="243">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding To, StringFormat='dd/MM/yyyy'}"
                                                                   Margin="5,2,2,2" HorizontalAlignment="Left"
                                                                   VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </StackPanel>
            </Grid>
        </ScrollViewer>
    </Grid>
</navigation:Page>
